﻿using System;
using System.ComponentModel;
using System.Data;
#if MONO_STRICT
	using System.Data.Linq;
#else   // MONO_STRICT
using DbLinq.Data.Linq;
using DbLinq.Vendor;
#endif  // MONO_STRICT
using System.Data.Linq.Mapping;
using System.Diagnostics;
using System.Data.SQLite;

namespace GameCoder.SqliteDAL
{
    public partial class GameContent
    {
        private static string dbPath = string.Format("{0}gamedb.db", AppDomain.CurrentDomain.BaseDirectory);
        private static string ConnectionString = string.Format(@"DbLinqProvider=Sqlite;Data Source={0}", dbPath);
        private static GameContent _instance;
        public static GameContent Instance
        {
            get
            {
                if (null != _instance)
                {
                    return _instance;
                }
                else
                {
                    Console.WriteLine(System.IO.File.Exists(dbPath) ? "Db exist" : string.Format("Db {0} is not exist", dbPath));
                    _instance = new GameContent(new SQLiteConnection(ConnectionString));
                    _instance.Connection.Open();
                    return _instance;
                }
            }
        }
    }
}
